package cn.waka.sys.admin.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.waka.sys.admin.object.Merchant;

@Mapper
public interface MerchantDao {
	int save(Merchant m);
	@Select("select id,name,`desc`,c_time as createTime,type from b_merchant where type=#{type} limit #{start},#{size}")
	List<Merchant> findPage(@Param("type")int type,@Param("start")int start,@Param("size")int size);
	@Select("select count(1) from b_merchant where type=#{type}")
	int findTotal(@Param("type")int type);
	
	@Insert("insert into b_merchant(name,type,c_time,`desc`)values(#{name},#{type},#{createTime},#{desc})")
	int insert(Merchant m);
	
	@Update("update b_merchant set name=#{name},type=#{type},c_time=#{createTime},`desc`=#{desc} where id=#{id}")
	int update(Merchant m);
	
	@Select("select name,type,c_time as createTime,`desc` from b_merchant where id=#{id}")
	Merchant getById(int id);
	
	@Delete("delete from b_merchant where id=#{id}")
	int del(int id);
	
	
	
}
